package com.lqian.time.localdate;

import java.time.LocalDate;

public class LocalTimeDemo {


    public static void main(String[] args) {


        LocalDate now = LocalDate.now();
        System.out.println(now);// 2022-07-07

        LocalDate of = LocalDate.of(2001, 9, 4);
        System.out.println(of);//2001-09-04

        LocalDate localDate = now.plusYears(20);
        System.out.println(localDate);//2042-07-07

        LocalDate localDate1 = now.minusYears(10); //2012-07-07
        System.out.println(localDate1);

        System.out.println(now.isBefore(of));// false
        System.out.println(now.isAfter(of));//true
        System.out.println(now.isLeapYear()); // leap year 闰年


        /**
         * 年：2022, 月：JULY, 日：7
         * 年：2022, 月：7, 日：7
         */
        System.out.println("年：" + now.getYear() + ", 月：" + now.getMonth() + ", 日：" + now.getDayOfMonth());
        System.out.println("年：" + now.getYear() + ", 月：" + now.getMonthValue() + ", 日：" + now.getDayOfMonth());



    }
}
